
# class Person():
#     def __init__(self,name,age):
#         self.name = name
#         self.age  = age
#
#     def __len__(self):
#         print("trigger...")
#         return 2
#
#
# p = Person("alex",22)
# p2 = Person("jack",22)
#
# print(p==p2)
#
# len(p)

class Brand:

    def __init__(self,name):
        self.name = name

    def __getitem__(self, item):
        print("---get item...",item,self.__dict__[item])

        print(self.__dict__)

    def __setitem__(self, key, value):
        print("set item")
        self.__dict__[key] = value


b = Brand("小猿圈")
b["name"]

b["website"] = "www.tuna.tsinghua.edu.cn"
b["website"] = "www.ustc.edu.cn"
print(b.website)